<?php
$maintenance = $this->maintenance;
$builder = $maintenance->builder;
$builder->db = $this->db;
$db = $this->db;
$tabs = $db->query_select('cllg_table_tab', "TABLE_NAME='$maintenance->table'");
?>

<form id="<?php echo FORM_NAME; ?>" name="<?php echo FORM_NAME; ?>" method="post" action="<?php echo CORE_PATH; ?>" >
    <input type="hidden" id="module" name="module" value="<?php echo $this->instanceName; ?>" />
    <div id="mant_head">
        <div id="titulo">Benefactor</div>
        <div id="botones">
            <button id="cmdOk" type="button" onclick="doSubmit('operation=s')">
                <img alt=""  src="imgv2/actions/document-save.png" />
            </button>
            <button id="cmdCancel" type="submit" onclick="doSubmit('')">
                <img alt=""  src="imgv2/actions/window-close.png" />
            </button>
        </div>
    </div>
    <div id="tabs">
        <ul>
            <li><a href="#tab1">INFORMACION PRINCIPAL</a></li>
            <?php
            foreach ($tabs as $t) {
                $ix = $t["ID"];
                $tabId = "_tab_" . $ix;
            ?>
                <li ><a href="#<?php echo $tabId; ?>"><?php echo $t["CAPTION"]; ?></a></li>
            <?php
            }
            ?>
        </ul>
        <div class="form-container" id="tab1">
            <fieldset title="Benefactor">
                <div>
                    <label for="ID">* CODIGO:</label>
                    <input name="IDN" type="text" id="IDN"  size="50" maxlength="100"   />
                </div>
                <div>
                    <label for="RAZON_SOCIAL">* Razon Social:</label>
                    <input name="RAZON_SOCIAL" type="text" id="RAZON_SOCIAL"  size="50" maxlength="100"   />
                </div>
                <div>
                    <label for="TELEFONO">* Telefono:</label>
                    <input name="TELEFONO" type="text" value="" id="TELEFONO" size="50" maxlength="100" /></div>
                <div>
                    <label for="DIRECCION">* Direccion:</label>
                    <input name="DIRECCION"  type="text" id="DIRECCION" size="50" maxlength="100" />
                </div>
                <div>
                    <label for="FAX">* Fax:</label>
                    <input name="FAX"  type="text" id="FAX" size="50" maxlength="100" />
                </div>
                <div>
                    <label for="EMAIL">* Correo Electronico:</label>
                    <input name="EMAIL"  type="text" id="EMAIL" size="50" maxlength="100" />
                </div>
                <div>
                    <input name="STATUS" type="hidden" id="STATUS" value="1" />
                </div>
            </fieldset>
            <div id="otrosdatos" style=" width: 98%; height: 260px;">
                <div style="width: 45%; float: left;">
                    <table id="hijos"></table>
                </div>
                <div id="pag"></div>
                <div id="alumnos" class="sublist" style="width: 45%; float: left;">
                    <table id="lstalumnos"></table><div id="alpag"></div>
                </div>
                <script type="text/javascript" >
                    (function($){
                        var path=AJAX_CORE_URL+'operation=hijos&ID='+jQuery("#ID").val();
                        crearTabla("#hijos","#pag",null,path,"Estudiantes Asignados",true);
                        $("#hijos").jqGrid('navGrid','#pag',{edit:false,add:false,del:false});
                        $("#t_hijos").css("height","80px;");
                        $("#t_hijos").append("<input type='button' id='addH' value='Agregar' style='height:20px; font-size:9px;'/>");
                        $("#t_hijos").append("<input type='button' id='delH' value='Quitar' style='height:20px; font-size:9px;'/>");
                        $("#delH").click(function(){ delHijo(); });
                        $("#addH").click(function(){ loadTodos(); });
                        $("#alumnos").hide();
                    })(jQuery);
                </script>
            </div>
        </div>
        <?php
            foreach ($tabs as $t) {
                $ix = $t["ID"]; ?>
                <div id="<?php echo $ix; ?>"  class="TabbedPanelsContent">
                    <div class="form-container" id="_tab_<?php echo $ix; ?>">
                        <fieldset>
                    <?php
                    $builder->build($maintenance->table, NULL, $t['ID']);
                    ?>
                </fieldset>
            </div>
            <?php
                }
            ?>
        </div>
    </div>
</form>
<script type="text/javascript">
    jQuery("#tabs").tabs();
</script>